<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>成绩查询</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<meta name="description" content="Write an awesome description for your new site here. You can edit this line in _config.yml. It will appear in your document head meta (for Google search results) and in your feed.xml site description.
">
<%
	pageContext.setAttribute("APP_PATH", request.getContextPath());
%>
<link rel="stylesheet" href="${APP_PATH }/static/wechat/css/weui.min.css">
<link rel="stylesheet" href="${APP_PATH }/static/wechat/css/jquery-weui.css">
<link rel="stylesheet" href="${APP_PATH }/static/wechat/css/demos.css">
<link rel="stylesheet" href="${APP_PATH }/static/bootstrap-3.3.7-dist/css/bootstrap.min.css">
</head>

<script type="text/javascript" src="${APP_PATH }/static/js/jquery-1.12.4.min.js"></script>
<script type="text/javascript" src="${APP_PATH }/static/wechat/js/jquery-weui.min.js"></script>
<script type="text/javascript" src="${APP_PATH }/static/wechat/js/jquery-weui.js"></script>

  <body ontouchstart>

	<!-- <div id="login">
	    <header class='demos-header'>
	      <h1 class="demos-title">模拟登陆</h1>
	    </header>
	
	    <div class="weui-cells weui-cells_form">
	      <div class="weui-cell">
	        <div class="weui-cell__hd"><label class="weui-label">学号</label></div>
	        <div class="weui-cell__bd">
	          <input class="weui-input" id="userID" type="text" placeholder="请输入凌展学号">
	        </div>
	      </div>
	      <div class="weui-cell">
	        <div class="weui-cell__hd"><label class="weui-label">密码</label></div>
	        <div class="weui-cell__bd">
	          <input class="weui-input"  id="pass" type="password" placeholder="请输入凌展密码">
	        </div>
	      </div>
	    </div>
	    <div class="weui-btn-area">
	      <a class="weui-btn weui-btn_primary" href="javascript:" id="submit">
	      	<span  id="loading">登陆</span>
	        <div class="weui-loadmore11" id="loading1" >
				<i class="weui-loading"></i> <span class="weui-loadmore__tips"></span>
		  	</div>
	      </a>
	    </div>
	</div> -->
	
	
	<div id="score">
			<!-- 标题 -->
			<div class="row">
				<div class="col-md-12">
					<h1 id="hello"></h1>
					<h3 id="major"></h3>
					<h3 id="userNO"></h3>
					<h3 id="className"></h3>
					<h2>小姐姐你的成绩如下:</h3>
				</div>
			</div>
			<!-- 显示表格数据 -->
			<div class="row">
				<div class="col-md-12">
<!-- 					<table class="table table-striped table-bordered" id="emps_table"> -->
					<table class="table  table-bordered" id="emps_table">
						<thead>
							<tr>
								<!-- <th>学年</th> -->
								<th style="width: 60px"  class="danger">学年</th>
								<th style="width: 200px" class="danger">课程</th>
								<th style="width: 50px"  class="danger">学分</th>
								<th style="width: 60px"  class="danger">成绩</th>
								<th style="width: 80px"  class="danger">状态</th>
							</tr>
						</thead>
						<tbody>
					
						</tbody>
					</table>
				</div>
			</div>
	</div>
		
		
		
		
			
	<script type="text/javascript">
	
		$(document).ready(function(){
			
				 var userID=$("#userID").val();
				 var pass=$("#pass").val();
				 $("#loading1").show();
				 $("#loading").hide();
					$.ajax({
						url:"${APP_PATH}/user/jdzxylogin",
						type:"POST",
						data: "username=" + userID + "&password=" + pass,
						success:function(data){
								$("#score").show();
									var $tr;
									var a=0;
									for(var j=0 ; j<data.length; j++){
										
										if(a==1){
											if(data[j-1].years == data[j].years){
												$tr='<tr>';
												$tr+='<td class="success">'+data[j].years+'</td>';
												$tr+='<td class="success">'+data[j].course+'</td>';
												$tr+='<td class="success">'+data[j].credit+'</td>';
												$tr+='<td class="success"> '+data[j].score+' </td>';
												$tr+='<td class="success"> '+data[j].state+' </td>';
												$tr+='</tr>'
											    $table.append($tr);
											}
											else{
												$tr='<tr>';
												$tr+='<td class="danger">'+data[j].years+'</td>';
												$tr+='<td class="danger">'+data[j].course+'</td>';
												$tr+='<td class="danger">'+data[j].credit+'</td>';
												$tr+='<td class="danger"> '+data[j].score+' </td>';
												$tr+='<td class="danger"> '+data[j].state+' </td>';
												$tr+='</tr>'
											    $table.append($tr);
											}
										}
										if(a==0){
											var $table = $("#emps_table");
											$tr='<tr>';
											$tr+='<td class="success">'+data[j].years+'</td>';
											$tr+='<td class="success">'+data[j].course+'</td>';
											$tr+='<td class="success">'+data[j].credit+'</td>';
											$tr+='<td class="success"> '+data[j].score+' </td>';
											$tr+='<td class="success"> '+data[j].state+' </td>';
											$tr+='</tr>'
										    $table.append($tr);
											a=1;
										}
								}
					}// success结束
			 	});// ajax结束
		});// jQuery加载结束
	</script>
	
</body>
</html>
